<?xml version="1.0" encoding="UTF-8"?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns="http://www.w3.org/1999/xhtml" version="2.1">
	<jsp:directive.page contentType="text/html; charset=UTF-8" />
	<jsp:directive.page isELIgnored="false" />
	<jsp:output omit-xml-declaration="false" doctype-root-element="HTML"
		doctype-system="about:legacy-compat" />
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

<title>Ikex</title>
<link rel="shortcut icon" href="${pageContext.request.contextPath }/img/favicon.png" />
<link rel="stylesheet"
	href="${pageContext.request.contextPath }/css/estilos.css"
	type="text/css" media="screen" charset="utf-8" />

<link rel="stylesheet"
	href="${pageContext.request.contextPath }/css/menuLateral.css"
	type="text/css" media="screen" charset="utf-8" />



<meta name="description" content="" />
<meta name="author" content="Emilio Javier Castillo Gonzalez" />

<script type="text/javascript" language="javascript" src="${pageContext.request.contextPath }/js/aniadirProducto/verColeccion.js">
<!-- a -->
</script>
<script type="text/javascript" language="javascript" src="${pageContext.request.contextPath }/js/stock/fueraStock.js">
<!-- a -->
</script>


</head>


<body>
	<c:import url="${pageContext.request.pathInfo}/jsp/menuLateral.jsp" />
	<div id="contenedor">
		<c:import url="${pageContext.request.pathInfo}/jsp/cabecera.jsp" />

		<div id="contenido" style="padding-top: 0px;">
			<div id="centro" style="margin-top: 0px;">
				<c:import url="${pageContext.request.pathInfo}/Admin/menuAdmin.jsp" />
				<c:import url="${pageContext.request.pathInfo}/Admin/menuProductos.jsp" />
				<jsp:useBean id="producto" class="es.ikex.beans.ProductosBean" scope="session" />
				<jsp:useBean id="proveedor" class="es.ikex.beans.ProveedorBean" scope="session" />
				<jsp:setProperty name="producto" property="*" />
				<jsp:setProperty name="proveedor" property="*" />
				<script type="text/javascript">
					var doc = document.getElementById("d");
					doc.setAttribute("class", "menuAdminHover");
				</script>
				<div class="cajaGrande left" >
				<div class="left">
				<form action="${pageContext.request.contextPath}/editarProducto" method="post">
					<c:forEach items="${producto.busquedaDetallada}" var="pro">
					<table class="tabla">
					<input type="hidden" name="codigo" value="${pro.codigo }"/>
						<tr>
							<td><label for="nombre">Concepto</label></td>
							<td><input required="required"  type="text" name="concepto" id="nombre" value="${pro.concepto }"/></td>
						</tr>
						
						<tr>
							<td><label for="Descripcion">Descripcion</label></td>
							<td><input  required="required" type="text" name="descripcion" id="descripcion" value="${pro.descripcion }"/></td>
						</tr>
						
						<tr>
							<td><label for="proveedor">Proveedor</label></td>
							<td>
								<select name="proveedores" id="proveedor" class="selectLargo">
									<c:forEach items="${proveedor.proveedores }" var="prove">
										<c:if test="${prove.codigo == pro.proveedor }">
											<option selected="selected" value="${prove.codigo }">${prove.razonSocial }</option>
										</c:if>
										<c:if test="${prove.codigo != pro.proveedor }">
											<option value="${prove.codigo }">${prove.razonSocial }</option>
										</c:if>
									</c:forEach>
								</select>
							</td>
						</tr>
						
						<tr>
							<td><label for="precio">Precio</label></td>
							<td><input  required="required" type="number"  min="1" step="0.01" name="precio" id="precio" value="${pro.precio }"/></td>
						</tr>
						
						<tr>
							<td><label for="stock">Stock</label></td>
							<td><input  required="required" type="number" step="1" name="stock" id="stock" value="${pro.stock }"/></td>
						</tr>
						
						<tr>
							<td><label for="stockMin">Stock minimo</label></td>
							<td><input  required="required" type="number"  step="1"  min="0" name="stockMinimo" id="stockMin" value="${pro.stockMinimo }"/></td>
						</tr>
						
						<tr>
							<td><label for="fuera">Fuera de catalogo</label></td>
							<td>
								<select name="fueraCatalogo" id="fuera">
									<option value="N">No</option>
									<option value="S">Si</option>
								</select>
							</td>
						</tr>
						
						<tr>
							<td><label for="medidas">Medidas</label></td>
							<td>
								<input required="required"  type="number" step="0.01" min="0.01" name="alto" id="medidas" class="estrecho"  value="${pro.alto }"/>
								<input  required="required" type="number" step="0.01" min="0.01" name="ancho" class="estrecho" value="${pro.ancho }"/>
								<input  required="required" type="number" step="0.01" min="0.01" name="profundidad" class="estrecho" value="${pro.profundidad }"/>
							</td>
						</tr>
						
						<tr>
							<td></td>
							<td><input type="submit" name="editar" value="Editar" /></td>
						</tr>
						
						</table>
						<span style="color: red;">${error }</span>
					</c:forEach>
				</form>
				</div>
				<div  class="rigth">
				<form action="${pageContext.request.contextPath}/editarProducto" method="post">
					<c:forEach items="${producto.busquedaDetallada}" var="pro">
					
					
					<table class="tabla">
					<input type="hidden" name="codigo" value="${pro.codigo }"/>
						<c:set var="c" value="${pro.codigo }"/>
						<tr>
							<td><label for="categoria">Categoria</label></td>
							<td>
								<select onchange="cargarTablaColecciones(this.value)" name="categoria" id="categoria" class="selectLargo">
									<c:forEach items="${productos.categoria }" var="cate">
										<c:if test="${cate.categoria == pro.categoria }">
											<option selected="selected" onclick="cargarTablaColecciones('${cate.codigo }')" value="${cate.codigo }">${cate.categoria }</option>
										</c:if>
										<c:if test="${cate.categoria != pro.categoria }">
											<option onclick="cargarTablaColecciones('${cate.codigo }')" value="${cate.codigo }">${cate.categoria }</option>
										</c:if>
										
									</c:forEach>
								</select>
							</td>
						</tr>
						<script>
							cargarTablaColecciones(document.getElementById('categoria').value);
						</script>
						<tr>
							<td><label for="coleccion">Coleccion</label></td>
							<td id="colecciones">
								
							</td>
						</tr>
						
						
						
						<tr>
							<td></td>
							<td><input type="submit" name="editarCategoria" value="Editar Categoria" /></td>
						</tr>
						
						</table>
					</c:forEach>
				</form>
				</div>
				<div style="clear: both;"><!-- adasf --></div>
				<form method="post" enctype="multipart/form-data" action="${pageContext.request.contextPath}/editarProducto">
					<table class="tabla">
						<input type="hidden" name="codigo" value="${c }"/>
						<tr>
							<td><input type="file" name="foto" /></td>
							<td><input type="submit" name="editarFoto" value="Cambiar foto" /></td>
						</tr>
					</table>
				</form>
			</div>
			</div>
			<div style="clear: both;"><!-- adasf --></div>
			<div id="der"></div>
		</div>
	</div>
	<script>
	cargarCalculoStock();
</script>
</body>

</html>
</jsp:root>